﻿using System;
using System.Collections.Generic;
using System.Text;
using FeedDotNet.Common;

namespace ConsoleApplication
{
    class NewzBinFeed : EncryptedMovieFeed
    {
        public NewzBinFeed(string url)
            : base(url)
        {
        }

        public override void PostProcess()
        {
            //do this before we post process in the base class
            //since these feeds are missing some information about resolution
            foreach (FeedItem item in _feed.Items)
            {
                if(item.Content.Contains("720p"))
                {
                   item.Title += string.Concat(".720p");
                }
                else if (item.Content.Contains("1080p"))
                {
                    item.Title += string.Concat(".1080p");
                }
            }

            for (int i = _feed.Items.Count - 1; i >= 0; i--)
            {
                if (!(_feed.Items[i].Title.Contains("720p") || _feed.Items[i].Title.Contains("1080p")))
                {
                    _feed.Items.RemoveAt(i);
                }
            }

            base.PostProcess();
        }
    }
}
